<%@ page pageEncoding="UTF-8"%>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-nested" prefix="nested"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/tags/trymore" prefix="tm"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix='fmt'%>

<style>
	.grid .gridTbody td.noborder {border-bottom: none;}
	.grid .gridTbody table.logcont td {line-height: 30px; padding: 0 5px; text-align: left;}
	.logtext {word-wrap:break-word; word-break:break-all; text-align:left;}
	.logtext div {overflow:auto; word-wrap: break-word;  text-align:left;}
</style>

<script>
	function forwardToWeek (ele_id) {
		navTab.reload("app/worklog.do?action=pageWorkLogMemberOverview&cat=${cat}&date=" + $("#"+ele_id).val());
	}
</script>

<div id="logwrapper_member">
	
	<!-- 周信息 -->
	<div class="panelBar" style="border-bottom:none; border-top:none;">
		<div style="float:left;">
			<h2 style="line-height:23px; padding: 0 0 0 5px;">
				一周工作日志  
				[
					<span style="color:#CF0800">
						<fmt:formatDate value="${startDate}" type="date" pattern="yyyy-MM-dd"/> 
						~
						<fmt:formatDate value="${endDate}" type="date" pattern="yyyy-MM-dd"/>
						(${weekParam}周)
					</span>
				]
			</h2>
		</div>
		<ul class="toolBar" style="float:right">
			<c:if test="${weekParam - 1 > 0}">
				<li>
					<a class="previous" href="app/worklog.do?action=pageWorkLogMemberOverview&week=${weekParam - 1}" 
						target="ajax" rel="logwrapper_member" title="查看上一周工作日志" mask="true" width="504" height="240">
						<span>上一周</span>
					</a>
				</li>
			</c:if>
			<li>
				<a class="icon" href="app/worklog.do?action=pageWorkLogMemberOverview&week=${weekNum}" 
					target="ajax" rel="logwrapper_member" title="查看本周工作日志" mask="true" width="504" height="240">
					<span>当前周</span>
				</a>
			</li>
			<c:if test="${weekParam + 1 <= maxWeekNum}">
				<li>
					<a class="next" href="app/worklog.do?action=pageWorkLogMemberOverview&week=${weekParam+1}" 
						target="ajax" rel="logwrapper_member" title="查看下一周工作日志" mask="true" width="504" height="240">
						<span>下一周</span>
					</a>
				</li>
			</c:if>
		</ul>
	</div>
	
	<!-- 周跳转 -->
	<div class="panelBar" style="height:30px;">
		<div class="searchBar" style="overflow:hidden;">
			<table class="searchContent" id="record_form" style="float:left">
				<tr>
					<td style="padding-right:10px;">
						<label style="line-height:30px;width:100px">跳转至日期所在周：</label>
						<input class="textInput date" value="<fmt:formatDate value="${currentDate}" type="date" pattern="yyyy-MM-dd"/>" id="worklogMStartDate" name="worklogStartDate" type="text" style="margin-top:5px;"/>
					</td>
					<td><a class="button" onclick="javascript:forwardToWeek('worklogMStartDate')"><span>跳转</span></a></td>
				</tr>
			</table>
			<logic:present name="singleTeam">
				<span style="float:right; line-height: 30px; color: #CF0800; padding-right: 5px;">小贴士：您没有带任何项目，只显示个人日志概要...</span>
			</logic:present>
		</div>
	</div>
	
	<!-- Body -->
	<div class="pageContent">
		<div id="datagrid">
			<table class="table" width="100%" layoutH="80">
				<thead>
					<tr>
						<th align="center" width="80px">姓名</th>
						<logic:present name="wholeDates">
							<logic:iterate name="wholeDates" id="date" indexId="idx">
								<th align="center" class="${date eq nowDate ? 'thover': ''}">${date}</th>
							</logic:iterate>
						</logic:present>
						<th align="center" width="80px">日志详细</th>
					</tr>
				</thead>
				<tbody>
					<logic:present name="users">
						<logic:iterate name="users" id="user" indexId="idx">	
							<c:if test="${user.id ne 1}">
								<tr ${idx % 2 == 1 ? 'style="background-color: #F5F5F5"' : ''}>
									<td>${user.username}</td>
									<logic:present name="wholeDates">
										<logic:iterate name="wholeDates" id="date">
											<c:choose> 
												<c:when test="${userFlags[user.id][date] ne null}"><td style="color: rgb(71, 192, 24);">OK</td></c:when>
												<c:otherwise><td style="color: rgb(255, 82, 0);">NO</td></c:otherwise>
											</c:choose>
										</logic:iterate>
									</logic:present>
									<td>
										<a class="oplink" target="dialog" title="日志详细 - ${user.username}" 
											href="app/worklog.do?action=dialogWorkLogQuery&cat=personal&uid=${user.id}&startDate=<fmt:formatDate value='${startDate}' type='date' pattern='yyyy-MM-dd'/>&endDate=<fmt:formatDate value='${endDate}' type='date' pattern='yyyy-MM-dd'/>" width="820" height="570"><span>日志详细 </span></a>
									</td>
								</tr>
							</c:if>
						</logic:iterate>
					</logic:present>
				</tbody>
			</table>
		</div>
	</div>
</div>